package com.example.demo.service;

import com.example.demo.dao.UserDao;
import com.example.demo.entity.UserEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class UserService {

    @Autowired(required = false)
    private UserDao userDao;

    //通过ID查询单条数据
    public UserEntity queryUserById(int uid){
        return userDao.queryUserByIdDao(uid);
    }

    //查询多条数据.
    public List<UserEntity> queryUserAll(){
        return userDao.queryUserAllDao();
    }

    //登录
    public UserEntity userLoginService(UserEntity user){
        return userDao.loginUserDao(user);
    }

    //重名
    public UserEntity chongService(UserEntity user) {
        return userDao.chongDao(user);
    }

    //注册
    public int insertUserService(UserEntity user) {
        return userDao.insertUserDao(user);
    }

    //修改个人信息
    public int userUpdateService(UserEntity user) {
        return userDao.userUpdateDao(user);
    }

}
